using System;
using System.Collections.Generic;
using System.Text;
using org.qsoft.rpcfx.bean;
using org.qsoft.rpcfx.util;

namespace org.qsoft.rpcfx.core
{
    public interface IInterface2Service
    {
        object mapping(string interfaceName);
    }


    public class QInterface2Service : IInterface2Service 
    {
        public object mapping(string interfaceName)
        {
            string realName = convertInterface2Service(interfaceName);
            object obj = TypeUtil.createObject(realName);
            return obj;
        }

        private string convertInterface2Service(string interfaceName)
        {
            int pos = interfaceName.LastIndexOf(".I");
            if (pos > -1)
                return interfaceName.Substring(0, pos + 1) + "Q" + interfaceName.Substring(pos + 2);
            else
                return interfaceName;
        }
    }
}
